var names = ['tom','jack','rose']
function createIterator(items) {
    var i = 0
    return {
        next :function() {
            var done = i >= items.length
            i++
        }
    }

}
var ietrator = createIterator([1,2,3])
console.log(ietrator.next());